import org.junit.Test;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class Demo3 {

    public static void main(String[] args) {
        String[] str = {"h", "a", "a"};
        int length = getLength(str);
        System.out.println(length);
    }


    public static int getLength(String[] str) {
        List<String> list = new ArrayList<>(Arrays.asList(str));
        list.removeAll(Collections.singleton("a"));
        return list.size();
    }

    @Test
    public static int toChar(String[] str) {
        int len = str.length;
        for (String s : str) {
            if (s.equals("a")) {
                len = len - 1;
            }
        }
        return len;
    }

}
